package com.zhoulei.employee;

import java.time.LocalDate;

/**
 * Manager 经理类 继承于Employee
 * 多了bonus属性
 * 重写了getSalary的方法
 */
public class Manager extends Employee{

    //私有字段
    private double bonus; //奖金

    //实例域初始化块
    {
        this.bonus = 0.0;
    }

    //构造 --采用super调用超类的方法
    public Manager() {
        super();
        this.bonus = 0.0;
    }

    public Manager(String name, int id, LocalDate date, double salary,double bonus)
    {
       super(name,id,date,salary);
       this.bonus = bonus;
    }

    public Manager(String name, int id,double bonus)
    {
        super(name,id);
        this.bonus = bonus;
    }


    public double getBonus() {
        return this.bonus;
    }

    public void setBonus(Double bonus){
        this.bonus = bonus;
    }

    //重写方法
    public double getSalary(){ //工资 = 实际工资+奖金
        return this.bonus + super.getSalary();  //super用于访问超类方法
    }



}
